home *** CD-ROM | disk | FTP | other *** search
/ Packard Bell - Internet on a CD / internet on a cd.cdr / Internet / sites / HTML_1 / swords-1.pl < prev    next >
Encoding:
Perl Script  |  1998-07-16  |  1.6 KB  |  55 lines

  1. #!/bin/perl
  2.  
  3. require "cgi-lib.pl";
  4.  
  5. if (&ReadParse(*input)) {
  6.      print &PrintHeader;
  7.      print "<h1>The solutions to your SWORDS request</h1>";
  8.      $num = length($input{'pat'});
  9.      print "<br><br>Solutions for : ";
  10.      print $input{'pat'};
  11.      print "<br> No more than : ";
  12.      print $input{'max'};
  13.      print "<br><br>";
  14.      $ar = "$num $input{'pat'} $input{'max'}";
  15.      $ar =~ s/\W/ /g;                  # untaint the input
  16.      open(PROG,"./swords $ar |");
  17.      $fo = <PROG>;
  18.      print $fo;
  19.      print "<OL>";
  20.      while(<PROG>)
  21.        { last if $_ eq ",,,\n"; 
  22.      print $_;
  23.      print"<br>";
  24.      }
  25.      print"</OL>";
  26.      print <PROG>;
  27.      }
  28. else {
  29.     print &PrintHeader;
  30.  
  31.     print <<EOF
  32. <title> Word Searching Program </title>
  33. <img src="http://blackcat.brynmawr.edu/~nswoboda/cross-t.gif" align=center>
  34. <h1> Word Searching Program</h1><br>
  35. Greetings!<p>
  36. This set up helps you find words from a standard 
  37. system dictionary.  All you have to do is provide 
  38. a pattern, placing a "_" in place of any character.  
  39. For example, <b>d___r</b> would search for all the 5 
  40. letter words that begin with <b>d</b> and end with an 
  41. <b>r</b>.<p>
  42. <form method="post" action="/cgi-bin/nik/swords.pl">
  43. <input name = "pat"><p>
  44. Select the maximum number of solutions to return
  45. <SELECT NAME="max"><OPTION SELECTED> 25
  46. <OPTION> 50 <OPTION> 75 <OPTION> 100 </SELECT> <P>
  47. <INPUT TYPE="reset" VALUE="Clear">
  48. <input type="submit" value="Find words!">
  49. </form> <b> PS:</b> Try to you use this to find 
  50. the longest word in the dictionary.  <hr>
  51. <i>Written by Nik Swoboda (nswoboda\@blackcat.brynmawr.edu)
  52. </i></html>
  53. EOF
  54.     }
  55.